﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using xn;

namespace KinectAPI
{
    /// <summary>
    /// Represents the user skeleton with his 15 nodes position
    /// </summary>
    public class UserSkeleton
    {

        #region Properties

        /// <summary>
        /// Head node
        /// </summary>
        public Point3D Head { get; set; }

        /// <summary>
        /// Neck node
        /// </summary>
        public  Point3D Neck;

        /// <summary>
        /// LeftShoulder node
        /// </summary>
        public  Point3D LeftShoulder;

        /// <summary>
        /// LeftElbow node
        /// </summary>
        public  Point3D LeftElbow;

        /// <summary>
        /// LeftHand node
        /// </summary>
        public  Point3D LeftHand;

        /// <summary>
        /// RightShoulder node
        /// </summary>
        public  Point3D RightShoulder;
        
        /// <summary>
        /// RightElbow node
        /// </summary>
        public  Point3D RightElbow;

        /// <summary>
        /// RightHand node
        /// </summary>
        public  Point3D RightHand;

        /// <summary>
        /// Torso node
        /// </summary>
        public  Point3D Torso;

        /// <summary>
        /// LeftHip node
        /// </summary>
        public  Point3D LeftHip;

        /// <summary>
        /// LeftKnee node
        /// </summary>
        public  Point3D LeftKnee;

        /// <summary>
        /// LeftFoot node
        /// </summary>
        public  Point3D LeftFoot;
        
        /// <summary>
        /// RightHip node
        /// </summary>
        public  Point3D RightHip;
        
        /// <summary>
        /// RightKnee node
        /// </summary>
        public  Point3D RightKnee;

        /// <summary>
        /// RightFoot node
        /// </summary>
        public  Point3D RightFoot;

        /// <summary>
        /// ID skeleton
        /// </summary>
        public uint Id { get; set; }

        #endregion

        #region Constructor

        /// <summary>
        /// Creates the user skeleton with all his 15 nodes position x, y, z
        /// </summary>
        /// <param name="id">The id skeleton</param>
        /// <param name="user">The user represented by a <key,value> pair 
        /// key: node
        /// value: node 3D position </param>
        public UserSkeleton(uint id, Dictionary<SkeletonJoint, SkeletonJointPosition> user)
        {
            Id = id;
            Head = user[SkeletonJoint.Head].position;
            Neck = user[SkeletonJoint.Neck].position;
            LeftShoulder = user[SkeletonJoint.LeftShoulder].position;
            LeftElbow = user[SkeletonJoint.LeftElbow].position;
            LeftHand = user[SkeletonJoint.LeftHand].position;
            RightShoulder = user[SkeletonJoint.RightShoulder].position;
            RightElbow = user[SkeletonJoint.RightElbow].position;
            RightHand = user[SkeletonJoint.RightHand].position;
            Torso = user[SkeletonJoint.Torso].position;
            LeftHip = user[SkeletonJoint.LeftHip].position;
            LeftKnee = user[SkeletonJoint.LeftKnee].position;
            LeftFoot = user[SkeletonJoint.LeftFoot].position;
            RightHip = user[SkeletonJoint.RightHip].position;
            RightKnee = user[SkeletonJoint.RightKnee].position;
            RightFoot = user[SkeletonJoint.RightFoot].position;
        }

        #endregion

    }
}
